package com.missilike.biz.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.missilike.domain.mapper.MilContentStatisticInfoMapper;
import com.missilike.domain.response.MilContentStatisticInfo;
import com.missilike.repository.entity.MilContentStatistic;
import com.missilike.repository.entity.extend.MilContentStatisticExtend;
import com.missilike.repository.mapper.MilContentStatisticMapper;
import com.missilike.biz.IMilContentStatisticService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 统计表 服务实现类
 * </p>
 *
 * @author kin
 * @since 2019-02-19
 */
@Service
public class MilContentStatisticServiceImpl extends ServiceImpl<MilContentStatisticMapper, MilContentStatistic> implements IMilContentStatisticService {

    @Override
    public IPage<MilContentStatisticInfo> getList(Page<MilContentStatisticInfo> page, String title, String statDate) {
        List<MilContentStatisticExtend> list = baseMapper.selectContentStatistic(page, title, statDate);
        page.setRecords(MilContentStatisticInfoMapper.MAPPER.toList(list));
        return page;
    }

    @Override
    public int importStatisticInfo() {
        return baseMapper.importStatisticInfo();
    }
}
